module Main
where
x = 5
y = (6, "Hello")
z = x * fst y

signum x =
	if x < 0
		then -1
	else if x > 0
		then 1
	else 0

square :: Int -> Int
square x = x * x

-- Case statements and layout (indentation).
f x =
	case x of
		0 -> 1
		1 -> 5
		2 -> 2
		_ -> -1

-- Alternative syntax.
g x = case x of {0 -> 1; 1 -> 5; 2 -> 2; _ -> -1}

-- Alternative function definition.
h 0 = 1
h 1 = 5
h 2 = 2
h _ = -1


-- Fibonacci Series
fib 1 = 1
fib 2 = 1
fib n = fib (n-1) + fib (n-2)


-- Multiplication by recursive addition
mult a 1 = a
mult a b = a + mult a (b - 1)


-- My map
my_map f [] = []
my_map f (x:xs) = f x : my_map f xs

i = \x -> x*x

